package com.qboot.monitor.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.qboot.common.entity.Result;
import com.qboot.common.exception.BusinessException;
import com.qboot.monitor.vo.Server;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 服务信息 控制层
 *
 * @author Tellsea
 * @date 2022/11/29
 */
@Api(tags = "服务信息 控制层")
@RestController
@RequestMapping("/monitor/serverMonitor")
public class ServerMonitorController {

    @ApiOperation("获取服务信息")
    @SaCheckPermission("monitor:serverMonitor:get")
    @GetMapping("/getInfo")
    public Result getInfo() {
        try {
            Server server = new Server();
            server.copyTo();
            return Result.ok("获取成功", server);
        } catch (Exception e) {
            e.printStackTrace();
            throw new BusinessException("获取服务信息异常");
        }
    }
}
